import request from '@/config/axios'

export interface WechatlVO {
  id: number
  name: string
  status: number
  createTime: Date
  url: string
}

export interface UpdateStatusReqVO {
  id: number
  status: number
}

// 创建客服链接配置
export const createWechatService = async (data) => {
  return await request.post({
    url: '/promotion/wechat-service/create',
    data: data
  })
}

// 更新客服链接配置
export const updateWechatService = async (data) => {
  return await request.put({
    url: '/promotion/wechat-service/update',
    data: data
  })
}

// 删除客服链接配置
export const deleteWechatService = async (id) => {
  return request.get({
    url: '/promotion/wechat-service/delete?id=' + id,
    method: 'delete'
  })
}

// 获得客服链接配置
export const getWechatService = async (id) => {
  return request.get({
    url: '/promotion/wechat-service/get?id=' + id,
    method: 'get'
  })
}

// 获得客服链接配置分页
export const getWechatServicePage = async (query) => {
  return request.get({
    url: '/promotion/wechat-service/page',
    method: 'get',
    params: query
  })
}

// 导出客服链接配置 Excel
export const exportWechatServiceExcel = async (query) => {
  return request.get({
    url: '/promotion/wechat-service/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 关闭客服链接
export const closeWechatService = async (id: number) => {
  return await request.put({ url: '/promotion/wechat-service/close?id=' + id })
}
